# include "lvgl.h"
//#include "sdio_sdcard.h"
//#include "TV_jump.h"
#include "RTC_Date_time.h"
//Color_Hex define
#define WHITE 0XFFFFFF
#define BLACK 0X252525
#define GREEN 0X689F38
#define GREEN2 0x8BC34A
#define BULE 0X00C0FF
#define GREY 0X1C1A1C
#define YELLOW 0Xfff143
#define RED 0xF44336


extern void main_menu_loading(void);




extern void back_home(void);

lv_obj_t * start_labe3;
lv_obj_t * start_loading_bar;

void draw_TV_icon(lv_obj_t * praent)
{
    lv_obj_t * TV_icon = lv_obj_create(praent);
    lv_obj_set_size(TV_icon,140,110);
    lv_obj_align(TV_icon,LV_ALIGN_CENTER,0,-40);

    lv_obj_t * TV_border = lv_obj_create(TV_icon);
    lv_obj_set_size(TV_border,70,50);
    lv_obj_set_style_border_width(TV_border,2,0);
    lv_obj_set_style_border_color(TV_border,lv_color_hex(0x3c70dc),0);
    lv_obj_set_scrollbar_mode(TV_border,LV_SCROLLBAR_MODE_OFF);
    lv_obj_align(TV_border,LV_ALIGN_CENTER,0,0);


      lv_obj_t * TV_label0 = lv_label_create(TV_icon);
      lv_obj_align(TV_label0,LV_ALIGN_CENTER,0,-30);
      lv_label_set_recolor(TV_label0,true);
      lv_label_set_text(TV_label0,"#3c70dc  \\   / ");

      lv_obj_t * TV_label1 = lv_label_create(TV_border);
      lv_obj_align(TV_label1,LV_ALIGN_CENTER,0,-5);
      lv_label_set_recolor(TV_label1,true);
      lv_label_set_text(TV_label1,"#3c70dc I     I");

       lv_obj_t * TV_label2 = lv_label_create(TV_border);
      lv_obj_align(TV_label2,LV_ALIGN_CENTER,0,12);
      lv_label_set_recolor(TV_label2,true);
      lv_label_set_text(TV_label2,"#3c70dc " LV_SYMBOL_MINUS);

      lv_obj_t * TV_label3 = lv_label_create(TV_icon);
      lv_obj_align(TV_label3,LV_ALIGN_CENTER,0,26);
      lv_label_set_recolor(TV_label3,true);
      lv_label_set_text(TV_label3,"#3c70dc ^            ^ ");



}



void start_loading(void)
{
  lv_obj_t * start_scr = lv_obj_create(NULL);

  draw_TV_icon(start_scr);

  lv_obj_t * start_label = lv_label_create(start_scr);
  lv_obj_center(start_label);
  lv_label_set_text(start_label,"Little TV ");


  lv_obj_t * start_labe2 = lv_label_create(start_scr);
  lv_obj_align(start_labe2,LV_ALIGN_CENTER,0,30);
  lv_label_set_text(start_labe2,"Author:Geek Nikola");

  start_labe3 = lv_label_create(start_scr);
  lv_obj_align(start_labe3,LV_ALIGN_CENTER,0,80);
  lv_label_set_text(start_labe3,"loading,pealse wait.");



  start_loading_bar = lv_bar_create(start_scr);

  lv_obj_set_size(start_loading_bar,200,20);
  lv_bar_set_range(start_loading_bar, 0, 100);


    static lv_style_t style_bg;
    static lv_style_t style_indic;

    lv_style_init(&style_bg);
    lv_style_set_border_color(&style_bg, lv_color_hex(GREEN));
    lv_style_set_border_width(&style_bg, 2);
    lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/
    lv_style_set_radius(&style_bg, 6);
    lv_style_set_anim_time(&style_bg, 1000);

    lv_style_init(&style_indic);
    lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
    lv_style_set_bg_color(&style_indic, lv_color_hex(GREEN2));
    lv_style_set_radius(&style_indic, 3);

     lv_obj_remove_style_all(start_loading_bar);  /*To have a clean start*/
    lv_obj_add_style(start_loading_bar, &style_bg, 0);
    lv_obj_add_style(start_loading_bar, &style_indic, LV_PART_INDICATOR);

     lv_obj_align(start_loading_bar,LV_ALIGN_CENTER,0,50);



     lv_scr_load_anim(start_scr,LV_SCR_LOAD_ANIM_NONE ,0,0,1);
  
}
